<template>
	<view class="container">


		<!-- 考试信息卡片 -->
		<view class="exam-info-card">
			<text class="exam-title">2024-2025年上学期九年级3月第一次模考</text>
			
			<!-- 进度环形图 -->
			<view class="progress-section">
				<view class="progress-circle">
					<view class="progress-ring">
						<text class="progress-text">27.6</text>
						<text class="progress-unit">%</text>
					</view>
					<text class="progress-label">科目进度</text>
				</view>
				<text class="progress-desc">共2000份 已阅17份</text>
			</view>
		</view>

		<!-- 题目列表 -->
		<view class="question-list">
			<!-- 第5题 -->
			<view class="question-card">
				<view class="question-header">
					<view class="question-title-section">
						<text class="question-title">第5题</text>
						<text class="info-icon">ⓘ</text>
					</view>
					<button class="mark-btn">我要阅卷 ></button>
				</view>
				
				<view class="stats-row">
					<view class="stat-item">
						<text class="stat-number blue">3人</text>
						<text class="stat-label">参与阅卷老师</text>
					</view>
					<view class="stat-item">
						<text class="stat-number orange">1050</text>
						<text class="stat-label">任务总量</text>
					</view>
					<view class="stat-item">
						<text class="stat-number teal">500</text>
						<text class="stat-label">我的任务量</text>
					</view>
				</view>
				
				<view class="progress-bars">
					<view class="progress-item">
						<view class="progress-info">
							<text class="progress-title">你的进度：17/200</text>
							<text class="progress-percent">20.67%</text>
						</view>
						<view class="progress-bar">
							<view class="progress-fill teal-bg" style="width: 20.67%"></view>
						</view>
					</view>
					
					<view class="progress-item">
						<view class="progress-info">
							<text class="progress-title">题目进度：200/1050</text>
							<text class="progress-percent">36.93%</text>
							<text class="view-more" @click="showQuestionProgress('第5题')">查看 ></text>
						</view>
						<view class="progress-bar">
							<view class="progress-fill orange-bg" style="width: 36.93%"></view>
						</view>
					</view>
				</view>
				
				<view class="action-row">
					<button class="review-btn">📄 我要回评</button>
				</view>
			</view>

			<!-- 第7、9题 -->
			<view class="question-card">
				<view class="question-header">
					<view class="question-title-section">
						<text class="question-title">第7、9题</text>
						<text class="info-icon">ⓘ</text>
					</view>
					<button class="mark-btn">我要阅卷 ></button>
				</view>
				
				<view class="stats-row">
					<view class="stat-item">
						<text class="stat-number blue">3人</text>
						<text class="stat-label">参与阅卷老师</text>
					</view>
					<view class="stat-item">
						<text class="stat-number orange">1050</text>
						<text class="stat-label">任务总量</text>
					</view>
					<view class="stat-item">
						<text class="stat-number-special">自取</text>
						<text class="stat-label">我的任务量</text>
					</view>
				</view>
				
				<view class="progress-bars">
					<view class="progress-item">
						<view class="progress-info">
							<text class="progress-title">你的进度：17/自取</text>
							<text class="progress-percent">-</text>
						</view>
					</view>
					
					<view class="progress-item">
						<view class="progress-info">
							<text class="progress-title">题目进度：200/1050</text>
							<text class="progress-percent">36.93%</text>
							<text class="view-more" @click="showQuestionProgress('第7、9题')">查看 ></text>
						</view>
						<view class="progress-bar">
							<view class="progress-fill orange-bg" style="width: 36.93%"></view>
						</view>
					</view>
				</view>
				
				<view class="action-row">
					<button class="review-btn">📄 我要回评</button>
					<button class="arbitrate-btn">📋 我要仲裁(100)</button>
				</view>
			</view>

			<!-- 第15-20题 -->
			<view class="question-card">
				<view class="question-header">
					<view class="question-title-section">
						<text class="question-title">第15-20题</text>
						<text class="info-icon">ⓘ</text>
					</view>
					<button class="mark-btn">我要阅卷 ></button>
				</view>
				
				<view class="stats-row">
					<view class="stat-item">
						<text class="stat-number blue">3人</text>
						<text class="stat-label">参与阅卷老师</text>
					</view>
					<view class="stat-item">
						<text class="stat-number orange">1050</text>
						<text class="stat-label">任务总量</text>
					</view>
					<view class="stat-item">
						<text class="stat-number teal">500</text>
						<text class="stat-label">我的任务量</text>
					</view>
				</view>
				
				<view class="progress-bars">
					<view class="progress-item">
						<view class="progress-info">
							<text class="progress-title">你的进度：17/200</text>
							<text class="progress-percent">20.67%</text>
						</view>
						<view class="progress-bar">
							<view class="progress-fill teal-bg" style="width: 20.67%"></view>
						</view>
					</view>
					
					<view class="progress-item">
						<view class="progress-info">
							<text class="progress-title">题目进度：200/1050</text>
							<text class="progress-percent">36.93%</text>
							<text class="view-more" @click="showQuestionProgress('第15-20题')">查看 ></text>
						</view>
						<view class="progress-bar">
							<view class="progress-fill orange-bg" style="width: 36.93%"></view>
						</view>
					</view>
				</view>
				
				<view class="action-row">
					<button class="review-btn">📄 我要回评</button>
					<button class="arbitrate-btn">📋 我要仲裁(100)</button>
				</view>
			</view>
		</view>

		<!-- 题量进度弹窗 -->
		<QuestionProgressModal 
			:visible="showProgressModal" 
			:questionTitle="currentQuestionTitle"
			:teacherData="currentTeacherData"
			@close="handleCloseProgressModal"
		/>
	</view>
</template>

<script>
import QuestionProgressModal from '@/components/QuestionProgressModal.vue'

export default {
	components: {
		QuestionProgressModal
	},
	data() {
		return {
			showProgressModal: false,
			currentQuestionTitle: '',
			currentTeacherData: []
		}
	},
	onLoad(options) {
		// 接收传递的参数
		if (options.taskTitle) {
			this.taskTitle = decodeURIComponent(options.taskTitle);
		}
	},
	methods: {
		goBack() {
			uni.navigateBack();
		},
		// 显示题量进度弹窗
		showQuestionProgress(questionTitle) {
			this.currentQuestionTitle = questionTitle;
			// 根据题目设置不同的教师数据
			if (questionTitle === '第7、9题') {
				this.currentTeacherData = [
					{ 
						name: '胡光微', 
						completed: 200, 
						total: 400, 
						progressPercent: 50,
						avatarColor: '#FF9800'
					},
					{ 
						name: '龙梅秀', 
						completed: 200, 
						total: 400, 
						progressPercent: 50,
						avatarColor: '#9C27B0'
					},
					{ 
						name: '谭汉清', 
						completed: 430, 
						total: '自取', 
						progressPercent: 0,
						avatarColor: '#607D8B'
					},
					{ 
						name: '李岳中', 
						completed: 200, 
						total: 400, 
						progressPercent: 50,
						avatarColor: '#3F51B5'
					},
					{ 
						name: '迪力热巴', 
						completed: 200, 
						total: 400, 
						progressPercent: 50,
						avatarColor: '#009688'
					}
				];
			} else {
				// 其他题目的默认数据
				this.currentTeacherData = [
					{ 
						name: '张老师', 
						completed: 150, 
						total: 300, 
						progressPercent: 50,
						avatarColor: '#FF5722'
					},
					{ 
						name: '李老师', 
						completed: 180, 
						total: 300, 
						progressPercent: 60,
						avatarColor: '#4CAF50'
					}
				];
			}
			this.showProgressModal = true;
		},
		// 关闭题量进度弹窗
		handleCloseProgressModal() {
			this.showProgressModal = false;
		}
	}
}
</script>

<style lang="less" scoped>
.container {
	min-height: 100vh;
	background: linear-gradient(180deg, #4DD0E1 0%, #A5D6A7 100%);
}

.exam-info-card {
	margin: 30rpx 30rpx 30rpx;
	background: white;
	border-radius: 20rpx;
	padding: 30rpx;
	box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
}

.exam-title {
	font-size: 32rpx;
	font-weight: bold;
	color: #333;
	line-height: 1.4;
	display: block;
	margin-bottom: 40rpx;
}

.progress-section {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20rpx;
}

.progress-circle {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 15rpx;
}

.progress-ring {
	width: 200rpx;
	height: 200rpx;
	border-radius: 50%;
	border: 20rpx solid #E0E0E0;
	border-left-color: #4DD0E1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	position: relative;
}

.progress-text {
	font-size: 64rpx;
	font-weight: bold;
	color: #333;
	line-height: 1;
}

.progress-unit {
	font-size: 32rpx;
	color: #666;
}

.progress-label {
	font-size: 28rpx;
	color: #666;
}

.progress-desc {
	font-size: 28rpx;
	color: #666;
}

.question-list {
	padding: 0 30rpx;
}

.question-card {
	background: white;
	border-radius: 20rpx;
	margin-bottom: 30rpx;
	padding: 30rpx;
	box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
}

.question-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 30rpx;
}

.question-title-section {
	display: flex;
	align-items: center;
	gap: 10rpx;
}

.question-title {
	font-size: 32rpx;
	font-weight: bold;
	color: #333;
}

.info-icon {
	font-size: 28rpx;
	color: #999;
}

.mark-btn {
	background: #4DD0E1;
	color: white;
	border: none;
	padding: 15rpx 25rpx;
	border-radius: 25rpx;
	font-size: 26rpx;
	white-space: nowrap;
}

.stats-row {
	display: flex;
	justify-content: space-around;
	margin-bottom: 30rpx;
	padding: 20rpx 0;
}

.stat-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 1;
}

.stat-number {
	font-size: 48rpx;
	font-weight: bold;
	margin-bottom: 8rpx;
}

.stat-number.blue {
	color: #2196F3;
}

.stat-number.orange {
	color: #FF9800;
}

.stat-number.teal {
	color: #26A69A;
}

.stat-number-special {
	font-size: 48rpx;
	font-weight: bold;
	margin-bottom: 8rpx;
	color: #26A69A;
}

.stat-label {
	font-size: 24rpx;
	color: #666;
}

.progress-bars {
	margin-bottom: 30rpx;
}

.progress-item {
	margin-bottom: 20rpx;
}

.progress-info {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10rpx;
}

.progress-title {
	font-size: 28rpx;
	color: #333;
}

.progress-percent {
	font-size: 28rpx;
	color: #333;
	font-weight: bold;
}

.view-more {
	font-size: 24rpx;
	color: #4DD0E1;
}

.progress-bar {
	height: 8rpx;
	background: #F0F0F0;
	border-radius: 4rpx;
	overflow: hidden;
}

.progress-fill {
	height: 100%;
	border-radius: 4rpx;
}

.teal-bg {
	background: #26A69A;
}

.orange-bg {
	background: #FF9800;
}

.action-row {
	display: flex;
	gap: 20rpx;
}

.review-btn {
	background: white;
	color: #4DD0E1;
	border: 2rpx solid #4DD0E1;
	padding: 25rpx;
	border-radius: 12rpx;
	font-size: 28rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8rpx;
	flex: 1;
}

.arbitrate-btn {
	background: #FFE0B2;
	color: #FF9800;
	border: none;
	padding: 25rpx;
	border-radius: 12rpx;
	font-size: 28rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8rpx;
	flex: 1;
}
</style>
